#include <map>
#include <vector>

#include "Constant.h"

using namespace std;

class EntityGenerator;
class EntityRegister;
class ForceGenerator;

struct Entity;
struct Vector3;

class SimulationManager
{
private:
	map<int, Entity*>							*entityList;
	map<ConstraintType, bool>					*constraints;
	map<ForceGeneratorType, ForceGenerator*>	*generators;

	float										lifeTimeLimit;

	Vector3										*boundVolMin;
	Vector3										*boundVolMax;
public:
												SimulationManager();
												~SimulationManager();

	Entity*										SimulationManager::AddEntity(int id, float mass, Vector3 *position, Vector3 *initForce);

	int											Count();

	void										DefineConstraint(int numberOfEntities);
	void										DefineConstraint(float maxLifeTime);
	void										DefineConstraint(Vector3* boundingMin, Vector3* boundingMax);
	void										DisableConstraint(ConstraintType type);

	Entity*										GetEntity(int id);
	map<int, Entity*>*							GetEntityList();
	ForceGenerator*								GetGenerator(ForceGeneratorType type);

	void										RegisterEntity(ForceGeneratorType type, int id);
	void										RegisterAllEntities(ForceGeneratorType type);
	void										RegisterSpring(int idSource, int idOther);
	void										RemoveEntity(int id);

	void										Update(float time);
};